//定义全局路径
var lujing = getPath() + '/deposit';

$('#depositButton').click(function() {
	//获取充值的数值
	var money = $('#depositInput').val();
	$.ajax({
		type: "post",
		url: lujing,
		async: true,
		dataType: 'json',
		data: {
			"method": "Deposit",
			"money": money,
		},
		success: function(jsonDate) {
			//console.log(jsonDate);
			
			var num = jsonDate.num;
			if(num == '充值金额不能为空') {
				var txt = '充值金额不能为空';
				window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.info);
			} else {
				var result = jsonDate.result;
				if(result == '充值成功') {
					var txt = '充值成功';
					window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.success);
					$('.ok').click(function(){
						window.location.href='deposit-records.html';
					});
				} else {
					var txt = '充值失败';
					window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
				}
			}

		}

	});
})